<template>
	<view class="relet-day-select">
		<u-popup :show="show" :closeable="true" mode="center" :round="10" @close="popClose">
			<view class="pop-title">续租订单</view>
			<view class="pop-box">
				<view>请选择要续租的天数</view>
				<u-number-box v-model="days" min="1"></u-number-box>
			</view>
			<view class="pop-foot">
				<button class="my-but-primary" @click="dateConfirm()">确定续租</button>
			</view>
		</u-popup>
	</view>
</template>
<script>
	import { mapState } from 'vuex'
	export default {
		name: 'relet-day-select',
		props: {
			endDate:{
				type:[Number],
				default:{}
			},
		},
		data() {
			return {
				show:false,
				days:1,
			}
		},
		watch: {
		},
		computed:{
			endDateData(){
				let time=this.endDate+(this.days*86400)
				let dt={
					text:uni.$u.date(time,'yyyy/mm/dd hh:MM'),
					date:uni.$u.date(time,'yyyy/mm/dd'),
					time:uni.$u.date(time,'hh:MM'),
					timestamp:time,
				}
				return dt
			},
			...mapState({
				$s:state => state.$style,
				sys:state => state.$sys,
			})
		},
		mounted(){
		},
		methods: {
			//确认日期
			dateConfirm(){
				this.show=false;
				this.$emit('dateConfirm',this.endDateData)
			},
			//打开日历控件
			popOpen(){
				this.show=true
			},
			//关闭日期弹窗
			popClose(){
				this.show=false
			},
		}
	};
</script>
<style lang="scss">
	.relet-day-select .pop-box{
		display: flex;
		justify-content: space-between;
		flex-direction: row;
		padding: 50rpx;
	}
</style>
